import random
from animal import Sheep,Tiger


# 定义房间类
class Room(object):

    # 定义字典存放房间号和动物
    storeRoom = {1: "", 2: "", 3: "", 4: "", 5: "", 6: "", 7: "", 8: "", 9: "", 10: ""}
    # 定义序列判断动物那种动物
    lisRoom = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

    # 获取存放后的序列
    def getLisRoom(self):
        return self.lisRoom

    # 获取存放动物后的字典
    def getStoreRoom(self):
        return self.storeRoom

    # 初始化存放动物
    def storeAnimal(self):
        lis = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        for num in lis:
            roomNum = random.choice(lis)
            if roomNum % 2 is 0:
                self.storeRoom.update([(num, Sheep())])
                self.lisRoom[num-1] = 1
            else:
                self.storeRoom.update([(num, Tiger())])
                self.lisRoom[num-1] = 0

    # 获取房间存放的动物对象
    def getAnimal(self, num):
        return self.storeRoom.get(num)

